<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<!doctype html>
<html class="x-border-box x-strict x-viewport">
<head>
<%@ include file="/common/head-system.jsp"%>
<title>列表</title>
<script type="text/javascript">
	window.refreshQuery = function() {
		document.getElementById("queryForm").submit();
	}
	jQuery(function(){
		openMenu(1, 1);
		jQuery("#main_title").html("列表")
	});
	function download() {
		var form = jQuery("#queryForm");
		jQuery("#form2Data").html(form.innerHTML);
		var form2 = jQuery("#downloadForm");
		form2[0].submit();
	}
</script>
<style type="text/css">
</style>
</head>
<body class="x-body x-reset x-border-layout-ct x-container">
	<s:actionerror />
	<s:actionmessage />
	<form action="list.do" method="post" id="queryForm">
		<ext:panel head="查询条件">
			<s:iterator value="entityWrapper.properties" id="p">
			<s:if test="#p.isQuery">
			<ext:formField labelname="%{#p.data.nameShow}" fieldname="%{'q.' + #p.data.nameText}">
				<input type="text" name="q.<s:property value="#p.data.nameText" />"
					value="<s:property value="q[#p.data.columnName]" />"
					class="x-form-field x-form-text" style="width: 100%" />
			</ext:formField>
			</s:if>
			</s:iterator>
		</ext:panel>
		<div
			style="width: 100%; height: 34px; text-align: right; padding: 3px 0px;">
			<s:url id="u" action="input" includeParams="none" />
			<ext:button name="下载" onclick='javascript:download();' />
			<ext:button name="添加" onclick='%{"javascript:window.open(\'" + #u +"\')"}' />
			<ext:button name="查询" width="50"
				onclick="jQuery('#mainForm').submit();" />
		</div>
		<ext:panel head="列表">
			<div class="my-grid">
				<table cellpadding="0" border="0" cellspace="0" width="100%">
					<tr>
						<td width="30"><ext:gridHeadCell>
							序号
						</ext:gridHeadCell></td>
						<s:iterator value="entityWrapper.properties" id="p">
						<s:if test="#p.isShow">
							<th>
							<ext:gridHeadCell>
								<s:property value="#p.data.nameShow" />
							</ext:gridHeadCell>
							</th>
						</s:if>
						</s:iterator>
						<td width="50"><ext:gridHeadCell align="center">
							操作
						</ext:gridHeadCell></td>
					</tr>
					<s:iterator value="page.result" id="vo" status="s">
						<s:if test="#s.count%2 == 1">
							<s:set name="rc" value="''" />
						</s:if>
						<s:else>
							<s:set name="rc" value="' x-grid-row-alt'" />
						</s:else>
						<tr class="x-grid-row<s:property value='rc' />">
							<td valign="middle" style="padding-left: 0px;"
								class=" x-grid-cell x-grid-cell-special x-grid-cell-first"><div
									style="text-align: right; font-weight: bolder;"
									class="x-grid-cell-inner">
									<s:property value="#s.count" />
								</div>
							</td>
							<s:iterator value="entityWrapper.properties" id="p">
							<s:if test="#p.isShow">
								<td valign="middle" class=" x-grid-cell"><div style="text-align: left;"
									class="x-grid-cell-inner">
									<s:if test='#p.propertyType == "date"'>
										<s:date name="#vo[#p.data.columnName]" format="%{#p.dateFormatShow}"/>
									</s:if>
									<s:elseif test='#p.hasDateFormat && #p.hasDateFormatShow'>
										<s:property value="#application.DateUtils.parseDateSafely(#vo[#p.data.columnName], #p.data.dateFormat, #p.dateFormatShow)" />
									</s:elseif>
									<s:elseif test='#p.isDict'>
										<s:property value="#application.M.getDictNameByTypeAndCode(#vo[#p.data.columnName], #p.data.dictType)" />
									</s:elseif>
									<s:else>
										<s:property value="#vo[#p.data.columnName]" />
									</s:else>
								</div></td>
							</s:if>
							</s:iterator>
							<s:if test="entityWrapper.hasKey">
								<td valign="middle" class=" x-grid-cell x-grid-cell-last">
								<div
									style="text-align: left;" class="x-grid-cell-inner">
									<s:set name="keyParams" value="''" />
									<s:iterator value="entityWrapper.keyProperties" id="p" status="s">
										<s:if test="#s.index == 0">
											<s:set name="keyParams" value="#keyParams + 'm.' + #p.data.nameText + '=' + #vo[#p.data.columnName]" />
										</s:if>
										<s:else>
											<s:set name="keyParams" value="#keyParams + '&' + 'm.' + #p.data.nameText + '=' + #vo[#p.data.columnName]" />
										</s:else>
									</s:iterator>
									<s:url id="u" action="input" includeParams="none" />
									<ext:button name="修改" onclick='%{"window.open(\'" + #u + "?" + #keyParams +"\')"}' />
									<s:url id="u" action="input!delete" includeParams="none" />
									<ext:button name="删除"
									onclick='%{"jQuery.hiddenRequest(\'" + #u + "?" + #keyParams +"\')"}' />
								</div>
								</td>
							</s:if>
						</tr>
					</s:iterator>
				</table>
			</div>
			<ext:page page="page" />
		</ext:panel>
	</form>
	<%@ include file="/common/foot.jsp"%>
	<form name="downloadForm" id="downloadForm" target="downloadFrame"
		action="list!download.do" method="post">
		<iframe name="downloadFrame" id="downloadFrame" style="display: none"></iframe>
		<div id="form2Data" style="display: none"></div>
	</form>
</body>
</html>